@echo off
echo ========================================
echo Workflow Management System Test
echo ========================================

REM Create output directory
if not exist "target\classes" mkdir target\classes

echo Step 1: Compiling core classes...
javac -d target\classes -encoding UTF-8 src\main\java\com\sjw\workflow\core\*.java
if %errorlevel% neq 0 (
    echo Core compilation failed
    pause
    exit /b 1
)

echo Step 2: Compiling DAG classes...
javac -d target\classes -cp target\classes -encoding UTF-8 src\main\java\com\sjw\workflow\dag\*.java
if %errorlevel% neq 0 (
    echo DAG compilation failed
    pause
    exit /b 1
)

echo Step 3: Compiling agent classes...
javac -d target\classes -cp target\classes -encoding UTF-8 src\main\java\com\sjw\workflow\agent\*.java
if %errorlevel% neq 0 (
    echo Agent compilation failed
    pause
    exit /b 1
)

echo Step 4: Compiling engine classes...
javac -d target\classes -cp target\classes -encoding UTF-8 src\main\java\com\sjw\workflow\engine\*.java
if %errorlevel% neq 0 (
    echo Engine compilation failed
    pause
    exit /b 1
)

echo Step 5: Compiling test class...
javac -d target\classes -cp target\classes -encoding UTF-8 src\main\java\com\sjw\SimpleTest.java
if %errorlevel% neq 0 (
    echo Test compilation failed
    pause
    exit /b 1
)

echo.
echo ========================================
echo Compilation completed successfully!
echo ========================================
echo.
echo Running test...
echo.

java -cp target\classes com.sjw.SimpleTest

echo.
echo ========================================
echo Test completed!
echo ========================================
pause
